#ifndef RANDOMMETHOD_H_
#define RANDOMMETHOD_H_

#include <algorithm>
#include <cstdlib>
#include <vector>

#include "../NewUserMethod.h"

class RandomMethod: public NewUserMethod {
private:
	const std::vector<int>& itens;
public:
	RandomMethod(const std::vector<int>& itens) :
		itens(itens) {
	}

	virtual std::vector<int> getItens() {
		unsigned n = itens.size();
		std::vector<int> r_itens;
		srand((unsigned) time(0));
		while (r_itens.size() != n) {
			int item = itens[rand() % n];
			if (count(r_itens.begin(), r_itens.end(), item) == 0)
				r_itens.push_back(item);
		}
		return r_itens;
	}
};

#endif /* RANDOMMETHOD_H_ */
